package com.kristin.service;

import example.kristin.mybatis.dao.MyEntityDao;
import example.kristin.mybatis.dao.MyUserDAO;
import example.kristin.mybatis.entity.MyEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


@Component
public class UserService {

    @Autowired
    public OrderService orderService;

    @Autowired
    private MyEntityDao myEntityDao;

    @Autowired
    private MyUserDAO myUserDAO;

    @Transactional
    public void test() {
        System.out.println("1234");
        System.out.println("myEntityDao--" +myEntityDao);
        System.out.println("myUserDAO--" +myUserDAO);
        MyEntity myEntity = new MyEntity();
        myEntity.setName("test");
        myEntityDao.saveMyEntity(myEntity);
//        jdbcTemplate.execute("insert into cust_user(login_name , password, create_time, update_time) values (\"kristin\", \"123456\", now(), now())");
//        System.out.println(orderService);
//        throw new NullPointerException();
    }

}
